package com.lehecai.core.lottery;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lehecai.core.IntegerBeanLabelItem;

/**
 * 彩期事件类型
 * @author Sunshow
 *
 */
public class PhaseEventType extends IntegerBeanLabelItem {
	
	private static final long serialVersionUID = -8054498843450677983L;

	private static final Logger logger = LoggerFactory.getLogger(PhaseEventType.class.getName());
	
	private static List<PhaseEventType> items = new ArrayList<PhaseEventType>();
	
	public final static PhaseEventType SALE_OPEN = new PhaseEventType("彩期开售", 1);
	public final static PhaseEventType SALE_UPLOAD_CLOSE = new PhaseEventType("单式销售截止", 2);
	public final static PhaseEventType SALE_SYNDICATE_CLOSE = new PhaseEventType("合买销售截止", 3);
	public final static PhaseEventType SALE_CLOSE = new PhaseEventType("彩期销售截止", 4);

	public final static PhaseEventType SWITCH = new PhaseEventType("彩期切换", 5);
	
	public final static PhaseEventType TERMINAL_CLOSE = new PhaseEventType("终端出票截止", 6);
	
	public final static PhaseEventType DRAW = new PhaseEventType("彩期开奖", 7);
	public final static PhaseEventType REWARD = new PhaseEventType("派奖", 8);

	protected PhaseEventType(String name, int value) {
		super(PhaseEventType.class.getName(), name, value);
		items.add(this);
	}

    private static List<PhaseEventType> _items;

    static {
        _items = Collections.unmodifiableList(items);
    }
	
	public static PhaseEventType getItem(int value){
		try {
			return (PhaseEventType)PhaseEventType.getResult(PhaseEventType.class.getName(), value);
		} catch (Exception e) {
			logger.error(e.getMessage(), e);
			return null;
		}
	}
	
	public static List<PhaseEventType> getItems() {
		return _items;
	}
}
